<?php $this->load->view('Pre/common/header.html');?>
<script type="text/javascript" src="<?php echo base_url()?>common/js/jquery.Msg.js"></script>
<!--clothesDetail-->
<script type="text/javascript" src="<?php echo base_url('common/home')?>/js/clothesDetail.js"></script>
<!--导航 begin-->
<div class="nav">
    <ul>
        <li class="cur">
            <span>商城</span>
            <a href="<?php echo site_url('shop/index')?>">MALL</a>
        </li>
        <li>
            <span>定制</span>
            <a href="">CUSTOM-MADE</a>
        </li>
    </ul>
</div>
<!--导航 end-->
<!--商品详情 begin-->
<div class="clothesDetail">
    <!--轮播图 和 选项 begin-->
    <div class="clothesTop">
        <!--左侧轮播图 begin-->
        <div class="topLeft">
            <div class="littleImgs">
                <ul>
                    <?php if(!empty($goodsimgs) && count($goodsimgs)>0):?>
                    <?php $index_img=0;?>
                    <?php foreach($goodsimgs as $goodsimgitem):?>
                    <li <?php echo $index_img==0?'class="choosed"':''?>><img src="<?php echo base_url().$goodsimgitem->thumbnail_img?>" width="99" height="136" alt="" /></li>
                    <?php $index_img++;?>
                    <?php endforeach;?>
                    
                    <?php else:?>
                    <li class="choosed"><img src="<?php echo base_url().$goodsModel->thumbnail_img?>" width="99" height="136" alt="" /></li>
                    <?php endif;?>
                </ul>
            </div>

            <img class="bigImg" src="<?php echo !empty($goodsimgs) && count($goodsimgs)>0? base_url().reset($goodsimgs)->thumbnail_img:base_url().$goodsModel->thumbnail_img;?>" width="402" height="572" alt="" />
        </div>
        <!--左侧轮播图 end-->
        <!--右侧选项 begin-->
        <div class="topRight">
            <h1><?php echo $goodsModel->title?></h1>
            <form method="get" action="<?php echo site_url('order/goods_pay')?>">
                <input id="goodsid" name="goodsid" type="hidden" value="<?php echo $goodsModel->goods_id?>" />
                <input id="backurl" name="backurl" type="hidden" value="<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']?>" />
                <div class="colorsCategory">
                    <div class="colorsTxt">颜色分类</div>

                    <div class="colorsCon">
                        <?php $fist_goodscolor=!empty($goodscolors) && count($goodscolors)>0?reset($goodscolors):null;?>
                        <ul>
                            <?php foreach($goodscolors as $goodscolorsitem):?>
                            <li <?php echo !empty($fist_goodscolor) && $fist_goodscolor->goods_color_id==$goodscolorsitem->goods_color_id?'class="colorselected"':''?> mark_val="<?php echo $goodscolorsitem->color_id?>" style="background:#<?php echo $goodscolorsitem->colorkey?>"><img src="<?php echo base_url('common/home')?>/img/colorSelected.png" width="35" height="35" alt="" /></li>
                            <?php endforeach;?>
                        </ul>

                        <input id="colorid" name="colorid" type="hidden" value="<?php echo !empty($fist_goodscolor)>0?$fist_goodscolor->color_id:''?>" />
                    </div>

                </div>

                <div class="size">
                    <div class="sizeTxt">参考尺寸</div>

                    <div class="sizeCon">
                        <?php $fist_goodssize=!empty($goodssizes) && count($goodssizes)>0?reset($goodssizes):null;?>
                        <ul>
                            <?php foreach($goodssizes as $goodssizesitem):?>
                            <li mark_val="<?php echo $goodssizesitem['size_id']?>" <?php echo !empty($fist_goodssize) && $fist_goodssize['goods_size_id']==$goodssizesitem['goods_size_id']?'class="sizeSelected"':''?>><?php echo $goodssizesitem['title']?></li>
                            <?php endforeach;?>
                        </ul>
                        <input id="sizeid" name="sizeid" type="hidden" value="<?php echo !empty($fist_goodssize)?$fist_goodssize['size_id']:''?>" />
                    </div>
                </div>

                <div class="count">
                    <div class="countTxt">数量</div>

                    <div class="countCon">
                        <span onclick="reduce_count()" class="min">-</span><input id="goods_count" name="goods_count" type="text" value="1" readonly="readonly" /><span onclick=" add_count()" class="add">+</span>
                    </div>

                    <script type="text/javascript">
                    function add_count() {
                        var old_val = parseInt($(".countCon #goods_count").val());
                        var new_val = old_val + 1;
                        $(".countCon #goods_count").val(new_val);
                    }
                    function reduce_count() {
                        var old_val = parseInt($(".countCon #goods_count").val());
                        var new_val = 1;
                        if (old_val > 1) {
                            new_val = old_val - 1;
                        }
                        $(".countCon #goods_count").val(new_val);
                    }
                    </script>
                </div>

                <div class="initPrice">
                    <div class="initPriceTxt">价格</div>
                    <div class="initPriceCon">￥ <?php echo $goodsModel->market_price?></div>
                </div>

                <div class="finalPrice">
                    <div class="finalPriceTxt">促销价格</div>
                    <div class="finalPriceCon">￥ <?php echo $goodsModel->shop_price?></div>
                </div>

                <!--<a class="buyNow" href="javascript:void(0);">立即购买</a>-->
                <input type="submit" value="立即购买" class="buyNow" />
            </form>
            <a class="addCartNow" href="javascript:add_cart('<?php echo site_url()?>');">加入购物车</a>
        </div>
        <!--右侧选项 end-->
    </div>
    <!--轮播图 和 选项  end-->
    <!--自由编辑区域 begin-->
    <div class="clothesEditer">
        <div class="editerTitle">商品详情</div>

        <div class="editerCon">
            <?php echo $goodsModel->goods_desc?>
        </div>
    </div>
    <!--自由编辑区域 end-->
    <!--轮播展示图 begin-->
    <div class="h440">
        <div class="slider">
            <ul>
                <!--hotgoods-->
                <?php foreach($hotgoods as $hotgoodsitem):?>
                <li>
                    <a href="<?php echo site_url('goods/details/'.$hotgoodsitem->goods_id)?>">
                        <img src="<?php echo base_url().$hotgoodsitem->thumbnail_img?>" width="250" height="354" alt="" />
                        <span class="clothesName"><?php echo $hotgoodsitem->title?>"</span>
                        <span class="clothesPrice">￥ <?php echo $hotgoodsitem->shop_price?></span>
                    </a>
                </li>
                <?php endforeach;?>
            </ul>
        </div>

        <a class="prev" href="javascript:void(0);"></a>

        <a class="next" href="javascript:void(0);"></a>
    </div>
    <!--轮播展示图 end-->
</div>
<!--商品详情 end-->
<?php $this->load->view('Pre/common/footer.html');?>
